var app = getApp();
    // $ = require("../../utils/util.js"),
    // user = require("../../api/userAPI.js"),
    // vendorApi = require("../../api/vendorAPI.js");

var $ = require("../../common/util"),
    user = {},
    vendorApi = {};


Page({
    data: {
        Info: "",
        UserInfo: {},
        versionNumber: "",
        IsChannel: false,
        isTypeLattice: true,
        panels:[{
          id: 1,
          icon: 'icon-gouwu',
          text: '我的拼团',
          color: '#DB384C',
          usable: false,
          isShow: true
        },{
          id: 2,
          icon: 'icon-xiaojinku',
          text: '我的金库',
          color: '#44AFA4',
          usable: false,
          isShow: true
        },{
          id: 3,
          icon: 'icon-time',
          text: '我的预约',
          color: '#44AFA4',
          usable: false,
          isShow: true
        },{
          id: 4,
          icon: 'icon-kanjia',
          text: '我的砍价',
          color: '#FFC333',
          usable: false,
          isShow: true
        },{
          id: 5,
          icon: 'icon-youhuiquan',
          text: '优惠券',
          color: '#56ABE4',
          usable: false,
          isShow: true
        },{
          id: 6,
          icon: 'icon-zuanshi',
          text: '会员俱乐部',
          color: '#FFC333',
          usable: false,
          isShow: true
        },{
          id: 7,
          icon: 'icon-liwu',
          text: '商品收藏',
          color: '#56ABE4',
          usable: false,
          isShow: true
        },{
          id: 8,
          icon: 'icon-shouhuodizhi',
          text: '收货地址',
          color: '#1BC2A6',
          usable: false,
          isShow: true
        },{
          id: 9,
          icon: 'icon-store',
          text: '关于商家',
          url: '../about/about',
          color: '#DB384C',
          usable: false,
          isShow: false
        },{
          id: 10,
          icon: 'icon-yonghufankui1',
          text: '用户反馈',
          color: '#DB384C',
          usable: false,
          isShow: true
        },{
          id: 11,
          icon: 'icon-jrtd',
          text: '我要代言',
          color: '#DB384C',
          usable: false,
          isShow: true
        }],
      show: false,
      alertInfo: '商家暂未开通此服务',
      alert: {
        color: '',
        icon: '',
        text: ''
      }
    },
    onShow: function (e) {
      this.setData({
        show: false
      });
    },
    bindPanelTap: function(e) {
        var id = e.currentTarget.id;
        var item = this.data.panels[id-1];
        if(item.usable) {
            wx.navigateTo({
                url: item.url
            });
        }
        else {
            this.showAlert(item);
        }
    },
    closeAlert: function () {
      this.setData({
        show: false,
        alert: {}
      });
    },
    showAlert: function(item) {
      this.setData({
        show: true,
        alert: {
          color: item.color,
          icon: item.icon,
          text: item.text
        }
      });
    }
});